package entities;

import java.util.Date;

import javax.validation.constraints.Email;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Past;

import org.springframework.format.annotation.DateTimeFormat;

public class Person {
    
    /**
     *  修改注解的 message 属性可定制消息, 定制国际化消息见 尚硅谷 SpringMVC 40集
     */
    @NotBlank(message="请填写姓名")
    private String name;
    
    @Past
    @DateTimeFormat(pattern="yyyy-MM-dd")
    private Date birth;
    
    // 正常的 String 转 Double, double 不需要添加注解, 如果是 156,165.5 则需要加注解
    private Double weight;
    
    @Email
    private String email;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Date getBirth() {
        return birth;
    }

    public void setBirth(Date birth) {
        this.birth = birth;
    }

    public Double getWeight() {
        return weight;
    }

    public void setWeight(Double weight) {
        this.weight = weight;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    @Override
    public String toString() {
        return "Person [name=" + name + ", birth=" + birth + ", weight=" + weight + ", email=" + email + "]";
    }
}
